package com.rhb.af.util;


import java.util.HashMap;
import java.util.Map;

import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AppContext {
	
	private static AppContext instance;
	private static Map map = null;
	

	private AppContext() {
		if(map == null){
			map = new HashMap();
		}
	}
	
	public synchronized static AppContext getInstance() {
		if (instance == null) {
			instance = new AppContext();
		}
		return instance;
	}
	
	public AbstractApplicationContext getAppContext(String str) {
		if(!map.containsKey(str)){
			map.put(str, new ClassPathXmlApplicationContext(str));
		}
		return (ClassPathXmlApplicationContext)map.get(str);
	}	
	
}
